package com.witmore.skyline.web.controller;

import com.witmore.skyline.web.controller.vo.param.MessageParam;
import com.witmore.skyline.web.controller.vo.param.MessageParamQuery;
import com.witmore.skyline.web.controller.vo.result.MessageResultVO;
import com.witmore.skyline.web.controller.vo.result.ResponsePageResult;
import com.witmore.skyline.web.controller.vo.result.ResponseResult;
import com.witmore.skyline.web.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;

/**
 * 消息相关接口
 * Author: 豆子高
 * Date: 2025/5/6 18:02
 */
@RequestMapping("api/message/")
@RestController
public class MessageController {

    @Autowired
    private MessageService messageService;

    /**
     * 消息列表 V2.1
     */
    @GetMapping(value = "list", name = "消息列表")
    public ResponsePageResult<MessageResultVO> list(MessageParamQuery paramQuery) {
        return messageService.list(paramQuery);
    }

    /**
     * 消息已读
     */
    @PostMapping(value = "read", name = "消息已读")
    public ResponseResult<Void> read(@Valid @RequestBody MessageParam messageParam) {
        return messageService.read(messageParam);
    }

}
